<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>arm_dotproduct_example_f32.c</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="cmsis.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->

<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 46px;">
  <td id="proglogo"><img alt="CMSIS Logo" src="CMSIS_Logo_Final.png"></td>
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">CMSIS-DSP
   &#160;<span id="projectnumber">Verison 1.1.0</span>
   </div>
   <div id="projectbrief">CMSIS DSP Software Library</div>
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>


<div id="CMSISnav" class="tabs1">
    <ul class="tablist">
      <li><a href="../../General/html/index.html"><span>CMSIS</span></a></li>
      <li><a href="../../Core/html/index.html"><span>CORE</span></a></li>
      <li class="current"><a href="../../DSP/html/index.html"><span>DSP</span></a></li>
      <li><a href="../../RTOS/html/index.html"><span>RTOS API</span></a></li>
      <li><a href="../../SVD/html/index.html"><span>SVD</span></a></li>
    </ul>
</div>
<!-- Generated by Doxygen 1.7.5.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="modules.html"><span>Reference</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('arm_dotproduct_example_f32_8c-example.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">arm_dotproduct_example_f32.c</div>  </div>
</div>
<div class="contents">
<div class="fragment"><pre class="fragment"><span class="comment">/* ---------------------------------------------------------------------- </span>
<span class="comment">* Copyright (C) 2010 ARM Limited. All rights reserved.   </span>
<span class="comment">*  </span>
<span class="comment">* $Date:        29. November 2010  </span>
<span class="comment">* $Revision:    V1.0.3 </span>
<span class="comment">*  </span>
<span class="comment">* Project:          CMSIS DSP Library  </span>
<span class="comment">* Title:            arm_dotproduct_example_f32.c                  </span>
<span class="comment">*  </span>
<span class="comment">* Description:  Example code computing dot product of two vectors. </span>
<span class="comment">* </span>
<span class="comment">* Target Processor: Cortex-M4/Cortex-M3  </span>
<span class="comment">*</span>
<span class="comment">*</span>
<span class="comment">* Version 1.0.3 2010/11/29 </span>
<span class="comment">*    Re-organized the CMSIS folders and updated documentation. </span>
<span class="comment">* </span>
<span class="comment">* Version 1.0.1 2010/10/05 KK </span>
<span class="comment">*    Production release and review comments incorporated.  </span>
<span class="comment">*</span>
<span class="comment">* Version 1.0.0 2010/09/20 KK</span>
<span class="comment">*    Production release and review comments incorporated.</span>
<span class="comment">* ------------------------------------------------------------------- */</span> 
 
<span class="preprocessor">#include &lt;math.h&gt;</span>     
<span class="preprocessor">#include &quot;<a class="code" href="arm__math_8h.html">arm_math.h</a>&quot;</span> 
 
<span class="comment">/* ---------------------------------------------------------------------- </span>
<span class="comment">* Defines each of the tests performed </span>
<span class="comment">* ------------------------------------------------------------------- */</span> 
<span class="preprocessor">#define MAX_BLOCKSIZE   32 </span>
<span class="preprocessor"></span><span class="preprocessor">#define DELTA           (0.000001f) </span>
<span class="preprocessor"></span> 
<span class="comment">/* ---------------------------------------------------------------------- </span>
<span class="comment">* Test input data for Floating point Dot Product example for 32-blockSize </span>
<span class="comment">* Generated by the MATLAB randn() function </span>
<span class="comment">* ------------------------------------------------------------------- */</span>  
<span class="comment">/* ----------------------------------------------------------------------  </span>
<span class="comment">** Test input data of srcA for blockSize 32   </span>
<span class="comment">** ------------------------------------------------------------------- */</span>  
<a class="code" href="arm__math_8h.html#a4611b605e45ab401f02cab15c5e38715" title="32-bit floating-point type definition.">float32_t</a> <a name="a0"></a><a class="code" href="arm__dotproduct__example__f32_8c.html#a0c248a472fdc0507e4ab7d693e4876b6">srcA_buf_f32</a>[<a name="a1"></a><a class="code" href="arm__convolution__example__f32_8c.html#af8a1d2ed31f7c9a00fec46a798edb61b">MAX_BLOCKSIZE</a>] =   
{   
-0.4325648115282207,    -1.6655843782380970,    0.1253323064748307,      
 0.2876764203585489,    -1.1464713506814637,    1.1909154656429988,      
 1.1891642016521031,    -0.0376332765933176,    0.3272923614086541,      
 0.1746391428209245,    -0.1867085776814394,    0.7257905482933027,      
-0.5883165430141887,     2.1831858181971011,   -0.1363958830865957,      
 0.1139313135208096,     1.0667682113591888,    0.0592814605236053,      
-0.0956484054836690,    -0.8323494636500225,    0.2944108163926404,      
-1.3361818579378040,     0.7143245518189522,    1.6235620644462707,      
-0.6917757017022868,     0.8579966728282626,    1.2540014216025324,      
-1.5937295764474768,    -1.4409644319010200,    0.5711476236581780,      
-0.3998855777153632,     0.6899973754643451 
};   
  
<span class="comment">/* ----------------------------------------------------------------------  </span>
<span class="comment">** Test input data of srcB for blockSize 32   </span>
<span class="comment">** ------------------------------------------------------------------- */</span>   
<a class="code" href="arm__math_8h.html#a4611b605e45ab401f02cab15c5e38715" title="32-bit floating-point type definition.">float32_t</a> <a name="a2"></a><a class="code" href="arm__dotproduct__example__f32_8c.html#a67d9082c1585d4854ae9ca38db170ff5">srcB_buf_f32</a>[<a class="code" href="arm__convolution__example__f32_8c.html#af8a1d2ed31f7c9a00fec46a798edb61b">MAX_BLOCKSIZE</a>] =   
{   
 1.7491401329284098,    0.1325982188803279,      0.3252281811989881,     
-0.7938091410349637,    0.3149236145048914,     -0.5272704888029532,     
 0.9322666565031119,    1.1646643544607362,     -2.0456694357357357,     
-0.6443728590041911,    1.7410657940825480,      0.4867684246821860,     
 1.0488288293660140,    1.4885752747099299,      1.2705014969484090,     
-1.8561241921210170,    2.1343209047321410,  1.4358467535865909,         
-0.9173023332875400,   -1.1060770780029008,      0.8105708062681296,     
 0.6985430696369063,   -0.4015827425012831,      1.2687512030669628,     
-0.7836083053674872,    0.2132664971465569,      0.7878984786088954,     
 0.8966819356782295,   -0.1869172943544062,      1.0131816724341454,     
 0.2484350696132857,    0.0596083377937976 
};   
 
<span class="comment">/* Reference dot product output */</span> 
<a class="code" href="arm__math_8h.html#a4611b605e45ab401f02cab15c5e38715" title="32-bit floating-point type definition.">float32_t</a>  <a name="a3"></a><a class="code" href="arm__dotproduct__example__f32_8c.html#ad57c1f9ad68d098d79b15ec6844a26fc">refDotProdOut</a> = 5.9273644806352142;   
 
<span class="comment">/* ---------------------------------------------------------------------- </span>
<span class="comment">* Declare Global variables  </span>
<span class="comment">* ------------------------------------------------------------------- */</span> 
<a class="code" href="arm__math_8h.html#a4611b605e45ab401f02cab15c5e38715" title="32-bit floating-point type definition.">float32_t</a> <a name="a4"></a><a class="code" href="arm__dotproduct__example__f32_8c.html#ad0bfd425dfe1ff2bda80fb957e464098">multOutput</a>[<a class="code" href="arm__convolution__example__f32_8c.html#af8a1d2ed31f7c9a00fec46a798edb61b">MAX_BLOCKSIZE</a>];  <span class="comment">/* Intermediate output */</span> 
<a class="code" href="arm__math_8h.html#a4611b605e45ab401f02cab15c5e38715" title="32-bit floating-point type definition.">float32_t</a> <a name="a5"></a><a class="code" href="arm__class__marks__example__f32_8c.html#afd4d61aad5f35a4e42d580004e2f9a1d">testOutput</a>;  <span class="comment">/* Final ouput */</span> 
 
<a class="code" href="arm__math_8h.html#a5e459c6409dfcd2927bb8a57491d7cf6" title="Error status returned by some functions in the library.">arm_status</a> <a name="a6"></a><a class="code" href="arm__dotproduct__example__f32_8c.html#a88ccb294236ab22b00310c47164c53c3">status</a>;       <span class="comment">/* Status of the example */</span> 

int32_t <a name="a7"></a><a class="code" href="arm__class__marks__example__f32_8c.html#a196718f834091385d38586a0ce4009dc">main</a>(<span class="keywordtype">void</span>) 
{ 
        uint32_t i;                      <span class="comment">/* Loop counter */</span> 
        <a class="code" href="arm__math_8h.html#a4611b605e45ab401f02cab15c5e38715" title="32-bit floating-point type definition.">float32_t</a> diff;          <span class="comment">/* Difference between reference and test outputs */</span> 
 
        <span class="comment">/* Multiplication of two input buffers */</span> 
        <a name="a8"></a><a class="code" href="group___basic_mult.html#gaca3f0b8227da431ab29225b88888aa32" title="Floating-point vector multiplication.">arm_mult_f32</a>(<a class="code" href="arm__dotproduct__example__f32_8c.html#a0c248a472fdc0507e4ab7d693e4876b6">srcA_buf_f32</a>, <a class="code" href="arm__dotproduct__example__f32_8c.html#a67d9082c1585d4854ae9ca38db170ff5">srcB_buf_f32</a>, <a class="code" href="arm__dotproduct__example__f32_8c.html#ad0bfd425dfe1ff2bda80fb957e464098">multOutput</a>, <a class="code" href="arm__convolution__example__f32_8c.html#af8a1d2ed31f7c9a00fec46a798edb61b">MAX_BLOCKSIZE</a>); 
         
        <span class="comment">/* Accumulate the multiplication output values to  </span>
<span class="comment">           get the dot product of the two inputs */</span> 
        <span class="keywordflow">for</span>(i=0; i&lt; <a class="code" href="arm__convolution__example__f32_8c.html#af8a1d2ed31f7c9a00fec46a798edb61b">MAX_BLOCKSIZE</a>; i++) 
    {          
                <a name="a9"></a><a class="code" href="group___basic_add.html#ga6a904a547413b10565dd1d251c6bafbd" title="Floating-point vector addition.">arm_add_f32</a>(&amp;<a class="code" href="arm__class__marks__example__f32_8c.html#afd4d61aad5f35a4e42d580004e2f9a1d">testOutput</a>, &amp;<a class="code" href="arm__dotproduct__example__f32_8c.html#ad0bfd425dfe1ff2bda80fb957e464098">multOutput</a>[i], &amp;<a class="code" href="arm__class__marks__example__f32_8c.html#afd4d61aad5f35a4e42d580004e2f9a1d">testOutput</a>, 1);        
    } 
 
        <span class="comment">/* absolute value of difference between ref and test */</span> 
        diff = fabsf(<a class="code" href="arm__dotproduct__example__f32_8c.html#ad57c1f9ad68d098d79b15ec6844a26fc">refDotProdOut</a> - <a class="code" href="arm__class__marks__example__f32_8c.html#afd4d61aad5f35a4e42d580004e2f9a1d">testOutput</a>); 
         
        <span class="comment">/* Comparison of dot product value with reference */</span> 
        <span class="keywordflow">if</span>(diff &gt; <a name="a10"></a><a class="code" href="arm__convolution__example__f32_8c.html#a3fd2b1bcd7ddcf506237987ad780f495">DELTA</a>) 
        { 
                <a class="code" href="arm__dotproduct__example__f32_8c.html#a88ccb294236ab22b00310c47164c53c3">status</a> = <a name="a11"></a><a class="code" href="arm__math_8h.html#a5e459c6409dfcd2927bb8a57491d7cf6a09457f2be656b35015fd6d36202fa376">ARM_MATH_TEST_FAILURE</a>; 
        } 
                 
        <span class="keywordflow">if</span>( <a class="code" href="arm__dotproduct__example__f32_8c.html#a88ccb294236ab22b00310c47164c53c3">status</a> == <a class="code" href="arm__math_8h.html#a5e459c6409dfcd2927bb8a57491d7cf6a09457f2be656b35015fd6d36202fa376">ARM_MATH_TEST_FAILURE</a>) 
        { 
          <span class="keywordflow">while</span>(1); 
        } 

    <span class="keywordflow">while</span>(1);                             <span class="comment">/* main function does not return */</span>
} 
 
</pre></div> </div>
</div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Data Structures</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Defines</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>


    <li class="footer">Generated on Wed Mar 28 2012 15:38:05 for CMSIS-DSP by ARM Ltd. All rights reserved.
    <!--
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.5.1 </li>
    -->
    </li>
   </ul>
 </div>


</body>
</html>
